<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<h:head>

</h:head>
<h:body>
	<h:panelGroup rendered="#{sessaoMB.usuario.administrador}">
		<f:view>
			<ui:include src="../topo.xhtml"></ui:include>
		</f:view>
		<div class="container">
			<div class="navegacao">&nbsp;&nbsp;&nbsp; Inicio > Cadastrar > Bloco > Listar</div>

			<div class="conteudo">

				<h:form id="form">
					<p:growl showDetail="true"></p:growl>
					<p:dataTable var="bloco" value="#{listarBlocoMB.lista}"
						rowKey="#{bloco}" paginator="true" rows="10"
						selection="#{listarBlocoMB.bloco}" selectionMode="single"
						filteredValue="#{listarBlocoMB.filteredBlocos}" id="blocosTable">


						<f:facet name="header">
            Lista de Blocos
        </f:facet>

						<p:column headerText="Codigo" sortBy="#{bloco.codigo}"
							filterBy="#{bloco.codigo}" id="cpf">
            #{bloco.codigo}
        </p:column>

						<p:column headerText="Nome" sortBy="#{bloco.nome}"
							filterBy="#{bloco.nome}" id="year">
            #{bloco.nome}
        </p:column>

						<p:column headerText="Descricão" sortBy="#{bloco.descricao}"
							filterBy="#{bloco.descricao}" id="manufacturer">
            #{bloco.descricao}
        </p:column>

						<p:column headerText="Ativo">
            #{bloco.ativo}
        </p:column>


						<p:column headerText="Editar">
							<p:commandButton icon="ui-icon-pencil"
								action="#{listarBlocoMB.editarBloco(bloco)}"></p:commandButton>
						</p:column>

						<p:column headerText="Remover">
							<p:commandButton icon="ui-icon-trash"
								actionListener="#{listarBlocoMB.removerBloco(bloco)}"
								update=":form"></p:commandButton>
						</p:column>

					</p:dataTable>


				</h:form>
			</div>
		</div>

		<div class="rodape">
			<ui:include src="/rodape.xhtml"></ui:include>
		</div>

	</h:panelGroup>



</h:body>
</html>